package com.study.行为型模式.观察者模式;

public class Client {

    public static void main(String[] args) {
        //创建一个WeatherData
        WeatherData weatherData = new WeatherData();
        //创建观察者
        CurrentConditions currentConditions = new CurrentConditions();
        Sina sina = new Sina();
        Baidu baidu = new Baidu();
        //将观察者注册到WeatherData中
        weatherData.registerObserver(currentConditions);
        weatherData.registerObserver(sina);
        weatherData.registerObserver(baidu);

        //测试
        System.out.println("通知各个注册的观察者");
        weatherData.setData(10,100,30);
    }
}
